package ch4;

import java.util.Scanner;

public class CompanyTest {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Company com = new Company();
        System.out.println("******超级拖拉机公司******");
        while (true) {
            System.out.println("1.查看公司信息、2.添加新员工、3.输出员工信息、4.删除员工信息、5.统计公司人数、" +
                    "6、查看最高工资、7、工资排序、0.退出");
            int a = input.nextInt();
            switch (a) {
                case 1:
                    System.out.println("公司信息");
                    com.show();
                    break;
                case 2:
                    Staff s = new Staff();
                    System.out.println("请输入新员工姓名：");
                    s.name = input.next();
                    System.out.println("请输入新员工性别：");
                    s.sex = input.next();
                    System.out.println("请输入新员工年龄：");
                    s.age = input.nextInt();
                    System.out.println("请输入新员工职务：");
                    s.position = input.next();
                    System.out.println("请输入新员工薪资：");
                    s.salary = input.nextDouble();
                    boolean aa = com.add(s);
                    if (aa) {
                        System.out.println("添加成功！");
                    } else {
                        System.out.println("员工已满，添加失败！");
                    }

                    break;
                case 3:
                    com.showStaff();
                    break;
                case 4:
                    System.out.println("请输入要删除的员工：");
                    String oldNa = input.next();
                    if (com.delete(oldNa))
                        System.out.println("删除成功！");
                    break;
                case 5:
                    System.out.println("统计公司人数");
                    System.out.println("公司一共有" + com.nuber() + "人");
                    break;
                case 6:
                    com.findTopSalary();
                    break;
//                case 7:
//                    System.out.println("排序结果为：");
//                    com.sortBySalDesc();
//                    break;
                case 0:
                    System.out.println("退出系统！");
                    return;
            }
        }
    }
}
